<script lang="ts" setup>
//长图
import { IndexShowData } from "@/api/interface";
import Image from "@/components/Black/Image.vue";
interface Props {
  data: IndexShowData;
}

defineProps<Props>();

//图片配置
const configImg = {
  small: "medium_large", //366
  medium: "medium_large", //472
  large: "medium_large", //472
};
</script>

<template>
  <template v-if="data">
    <router-link :to="`/single/${data.id}`" class="tile tile-hero">
      <div class="tile__media">
        <Image :data="data.image" :config="configImg"></Image>
      </div>

      <div class="tile__description">
        <div class="tile__head">
          <div class="tile__category">
            <span v-for="key in data.cat">
              {{ key.name }}
            </span>
          </div>

          <div class="tile__headline">
            {{ data.title }}
          </div>
        </div>
        <div class="tile__timestamp">{{ data.date }}</div>
      </div>
    </router-link>
  </template>
  <template v-else>加载中</template>
</template>

<style lang="less" scoped>
.tile-hero {
  flex-direction: row;
  width: 100%;
  .tile__media {
    width: 100%;
    height: auto;
    min-height: 590px;
    flex-basis: 472px;
    flex-shrink: 1;
    > div {
      display: inline;
    }
  }
  .tile__description {
    padding: 32px;
    justify-content: space-between;
    flex-basis: 0;
    .tile__head {
      display: flex;
      flex: 1;
      flex-direction: column;
      .tile__category {
        letter-spacing: 0em;
        margin-bottom: auto;
      }
    }
    .tile__timestamp {
      margin-top: 12px;
      font-family: "SF Pro SC", "SF Pro Text", "SF Pro Icons", "PingFang SC",
        "Helvetica Neue", "Helvetica", "Arial", sans-serif;
      letter-spacing: 0em;
    }
  }
  .tile__headline {
    font-size: 40px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 0em;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
    font-family: "SF Pro SC", "SF Pro Display", "SF Pro Icons", "PingFang SC",
      "Helvetica Neue", "Helvetica", "Arial", sans-serif;

    margin-bottom: auto;
    margin-top: 8px;
  }
}
.tile-hero:hover .tile__media .image {
  transform: scale(1.03);
  transition: @img-tra;
}

@media only screen and (max-width: 734px) {
  .tile-hero {
    flex-direction: column;
    width: 100%;
    .tile__media {
      width: 100%;
      height: auto;
      min-height: auto;
      flex-basis: auto;
      flex-shrink: 1;
      //padding-top: 125%;
      //height: 0;
      position: relative;
    }
    .tile__description {
      padding: 24px;
      justify-content: space-between;
      flex-basis: auto;
    }
    .tile__category {
      margin-bottom: 8px;
    }
    .tile__timestamp {
      margin-top: 8px;
    }
  }
}
@media only screen and (max-width: 1068px) {
  .tile-hero {
    .tile__headline {
      font-size: 19px;
      line-height: 1.21053;
      font-weight: 700;
      letter-spacing: 0.012em;
      font-family: "SF Pro SC", "SF Pro Display", "SF Pro Icons", "PingFang SC",
        "Helvetica Neue", "Helvetica", "Arial", sans-serif;
    }
  }
}
</style>
